﻿using System;
using System.Reflection;
namespace HBFramework
{
    public class ReflectUtility
    {
        /// <summary>
        /// 通过名字创建实例
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <returns></returns>
        public static T CreateInstanceByName<T>(string name) where T : class
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            var effectType = assembly.GetType(name);
            T instance = Activator.CreateInstance(effectType) as T;
            return instance;
        }
    }
}